<html>
<head>
 
</head>
<body style="text-align=center;font-size:32px;">
<table align="center">
<tr><td><div id="problemNum" style='background-color:#999999;width:800;text-align:center;font-size:32px;'></div></td></tr>
<tr><td><div id="problemContent" style='word-wrap:break-word;background-color:#bbbbbb;width:800;text-align:left;font-size:20px;'></div></td></tr>
<tr><td><div id="result" style='word-wrap:break-word; color:#ffff22;font-size:48;background-color:#8855ff;width:800;text-align:center;'></div></td></tr>
<tr><td><div id="copyleft" style='word-wrap:break-word; color:#ffff22;font-size:18;background-color:#666666;width:800;text-align:right;'></div></td></tr>
<script language="javascript">
    //---------------------------------//
    // Project Euler 
    //
    // Author:thrombin
    //   Date:2015-12-09
    //---------------------------------//  
var p_order=10;//Problem Order
 
var problem="The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million."
 
//solve the problem
//==============编程思路简介================
//  存储已经得到的素数进数组，
//  通过判断已得到的素数是否能整除当前值，即可判断当前值是否为素数
//  得到所有小于2 million的素数后，直接求和。
//=====================================
var primes=[2,3]
var sum=5;
 
for(var i=5;i<2e6;i+=2){
    is_prime=true;
    for(var j=0;j<primes.length ;j++){
        if((primes[j]*primes[j])>i)break;
        if(i%primes[j]==0){is_prime=false;break;}
    }
    if(is_prime){primes.push(i);sum+=i;}
}
 
 
//update browser
document.getElementById("problemNum").innerHTML="Project Euler-Problem "+p_order;
document.getElementById("problemContent").innerHTML=problem;
document.getElementById("result").innerHTML="Answer:"+sum;
document.getElementById("copyleft").innerHTML="CopyLeft@Thrombin    2015";
</script>
</body>
</html>